import java.util.HashMap;
import java.util.Scanner;

public class day230413 {
    // 找出字符串中第一个只出现一次的字符

    // 计数数组
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            char[] arr = in.nextLine().toCharArray();
            // 计数数组
            int[] count = new int[128];
            for (int i = 0; i < arr.length; i++) {
                count[arr[i]]++;
            }

            for (int i = 0; i < arr.length; i++) {
                if (count[arr[i]] == 1) {
                    System.out.println(arr[i]);
                    return;
                }
            }
            System.out.println(-1);
        }
    }

    // 用HashMap计数
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        HashMap<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) {
            map.put(c, map.getOrDefault(c, 0) + 1);
        }
        for (char c : s.toCharArray()) {
            if (map.get(c) == 1) {
                System.out.println(c);
                return;
            }
        }
        System.out.println(-1);
    }

    // 小易的升级之路
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int a = sc.nextInt();
            for (int i = 0; i < n; i++) {
                int b = sc.nextInt();
                a = upgrade(a, b);
            }
            System.out.println(a);
        }
    }
    private static int upgrade(int a, int b) {
        if (a >= b) {
            return a + b;
        } else {
            int t = a; // 记录小易的能力值
            // 辗转相除法，计算最大公约数
            while (b != 0) {
                int tmp = a % b;
                a = b;
                b = tmp;
            }
            a += t;// 相加
        }
        return a;
    }
}
